
Version:=0.3e
ModuleName:=ibsh

Object:=$(ModuleName).tgz
ObjectDir:=$(ModuleName)-$(Version)
ObjectSource:=$(ModuleName)-$(Version).tar.gz

Object2:=cmd.tgz

DependFiles:=
InstaEtcDir:=usr/local/etc
InstaLibDir:=usr/lib
InstaSbinDir:=usr/local/sbin
InstaHomeDir:=usr/home
InstaBinDir:=usr/bin

InstallDirTmp:=usr/local/
InstallDir:=/$(InstallDirTmp)
ManDir:=/tmp

Cmd_List:=reset

.PHONY: all clean dist_clean

all:$(Object) $(Object2)

$(Object):$(ObjectSource) globals.cmds globals.xtns
	tar -xzf $(ObjectSource)
	patch -p0 < ibsh.patch
	$(MAKE) -C $(ObjectDir)
	mkdir -p usr/local/etc/ibsh
	mkdir -p usr/local/etc/ibsh/cmds
	mkdir -p usr/local/etc/ibsh/xtns
	mkdir -p usr/local/bin/
	mkdir -p $(InstaLibDir)
	mkdir -p $(InstaHomeDir)
	cp -rf /lib/libreadline.so.5 /lib/libreadline.so.5.2 $(InstaLibDir)
	cp -rf $(ObjectDir)/ibsh usr/local/bin/
	cp -rf ./globals.cmds usr/local/etc/ibsh/
	cp -rf ./globals.xtns usr/local/etc/ibsh/
	tar -czf $(Object) usr

$(Object2):
	mkdir -p $(InstaBinDir)
	cd cmd; cp -rf $(Cmd_List) ../$(InstaBinDir)
	tar -czvf cmd.tgz $(InstaBinDir)

diff:
	$(MAKE) -C $(ObjectDir) clean
	rm -rf $(ObjectDir)/tags $(ObjectDir).new
	mv $(ObjectDir) $(ObjectDir).new
	tar -xzf $(ObjectSource)
	-diff -Naur $(ObjectDir) $(ObjectDir).new > ibsh.patch

patch:
	patch -p0 < ibsh.patch

test:globals.cmds globals.xtns
	$(MAKE) -C $(ObjectDir) 
	mkdir -p usr/local/etc/ibsh
	mkdir -p usr/local/etc/ibsh/cmds
	mkdir -p usr/local/etc/ibsh/xtns
	mkdir -p usr/local/bin/
	mkdir -p $(InstaLibDir)
	mkdir -p $(InstaHomeDir)
	cp -rf /lib/libreadline.so.5 /lib/libreadline.so.5.2 $(InstaLibDir)
	cp -rf $(ObjectDir)/ibsh usr/local/bin/
	cp -rf ./globals.cmds usr/local/etc/ibsh/
	cp -rf ./globals.xtns usr/local/etc/ibsh/
	tar -czf $(Object) usr
	mkdir -p $(InstaBinDir)
	cd cmd; cp -rf $(Cmd_List) ../$(InstaBinDir)
	tar -czvf cmd.tgz $(InstaBinDir)
	scp $(Object) $(Object2) 192.168.1.200:/packages
	ssh 192.168.1.200  tar xzvf /packages/$(Object)
	ssh 192.168.1.200  tar xzvf /packages/$(Object2)
clean:
	rm -rf *.tgz usr 

dist_clean:clean
	rm -rf $(ObjectDir) $(ObjectSource) $(ObjectDir).new
	
include ../Makefile.Res
